const db = require('../../mysql')
const path = require('path')

// 获取讨论数据
exports.getComment = (req, res) => {
    const getCommentSql = 'SELECT * FROM comment'
    db.query(getCommentSql, (err, result) => {
        if (err) return res.cc(err)
        if(result.length !== 0) {
            result.forEach(element => {
                element.time = element.time.getFullYear()+'-'+(element.time.getMonth()*1+1)+'-'+element.time.getDate()
            });
            res.send({
            status: 0,
            message: '获取讨论列表成功',
            data: result,
        })
        }
    })
}